#!/opt/python-2.5/bin/python2.5

import cgi, cgitb
cgitb.enable()
print "Content-type: text/html;charset=utf-8"
print 
print "<body bgcolor=000040 text=E4E4E4 <title>Revelator Demo Player Acknowledgment</title>"
form = cgi.FieldStorage()
roll = dict()
namefile = "tempdir/players.file"
file = open(namefile, 'r')
for entry in file:	roll[entry[:-1]] = "present"
file.close()
if "Name" in form.keys():
	name = form["Name"].value
	roll[name] = "present"
print "<h1 align=center><font face=Arial size=7 color=D3FFD3>"
print "Welcome to Revelator, " + name + "!"
print "</font></h1>"
print "<form name=\"Printer\" method=get>"
print "<input name=\"Name\" type=hidden color=\"red\" value=" + name + " />\t"
print "<a href=\"startdemo.cgi?Delete=" + name + "\">"
print "<button type=button name=\"Quit\">Quit being " + name + "</button></a>\t"
print "<button type=submit name=\"Submit\">Reset page</button>"
print "</form></body>"
file = open(namefile, 'w')
for entry in roll:	
	file.write(entry + "\n")
file.close()
